module.exports = (app) => {
  const { STRING, INTEGER, DECIMAL, DATE, NOW } = app.Sequelize

  const Cart = app.model.define(
    't_cart',
    {
      id: {
        type: INTEGER,
        primaryKey: true,
        autoIncrement: true,
        comment: '购物车商品主键'
      },
      user_id: {
        type: INTEGER,
        allowNull: false,
        comment: '用户外键'
      },
      goods_id: {
        type: INTEGER,
        allowNull: false,
        comment: '商品主键'
      },
      goods_num: {
        type: INTEGER,
        allowNull: false,
        defaultValue: 1,
        comment: '数量'
      },
      created_at: {
        type: DATE,
        allowNull: false,
        defaultValue: NOW,
        comment: '创建时间'
      },
      updated_at: {
        type: DATE,
        allowNull: false,
        defaultValue: NOW,
        comment: '更新时间'
      }
    },
    {
      freezeTableName: true, // Model 对应的表名将与model名相同
      timestamps: false
    }
  )
  return Cart
}
